<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html xmlns:th="" lang="zh-CN">
<%@include file="/WEB-INF/pages/base/include.jsp"%>
<body>
<div id="wrapper">
    <%@include file="/WEB-INF/pages/base/menu.jsp"%>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h3 class="page-header">财务管理</h3>
            </div>
        </div>
        <div class="row">
            <form class="form-horizontal" data-parsley-validate>
                <div class="col-lg-12 col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">提现详情</div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12 col-md-12">
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">创建时间：</label>
                                        <div class="col-lg-8">
                                            <p id="createTime"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">申请人：</label>
                                        <div class="col-lg-8">
                                            <p id="accountName"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">状态：</label>
                                        <div class="col-lg-8">
                                            <p id="status">成功</p>
                                        </div>
                                    </div>
                                    <hr>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">交易类型：</label>
                                        <div class="col-lg-8">
                                            <p id="type"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">剩余可提现金额：</label>
                                        <div class="col-lg-8">
                                            <p id="withdrawals"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">金额：</label>
                                        <div class="col-lg-8">
                                            <p id="money"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">提现账号：</label>
                                        <div class="col-lg-8">
                                            <p id="accountBank"></p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 clo-md-2 control-label">提现账号：</label>
                                        <div class="col-lg-8">
                                            <p id="accountBankNumber"></p>
                                        </div>
                                    </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
                <a class="btn btn-primary" href="javascript:void(0);" onclick="deal(1)"
                style="margin-left:15px;margin-bottom:30px;">同意</a>
                <a class="btn btn-default" href="javascript:void(0);" onclick="deal(0)"
                style="margin-left:15px;margin-bottom:30px;">驳回</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script>	
   	$(function(){
   		var withdrawalsUuid = "${withdrawalsUuid}";
  		var baseURL = "${webPath}/withdrawals/detail";
      	var json_package = {
           "head": {},
           "body": {
           	"withdrawalsUuid": withdrawalsUuid
           }
       	}
   		$.post(baseURL, {"json_package": JSON.stringify(json_package)}, function (result) {
          if (typeof result == 'string') result = JSON.parse(result);
          if (result.body.result == '1') {
              alert(result.body.description)
          } else {
          	var withdrawals = result.body.withdrawals;
          	$("#createTime").text(withdrawals.createTime);
          	$("#accountName").text(withdrawals.accountName);
          	$("#accountBank").text(withdrawals.accountBank);
          	$("#accountBankNumber").text(withdrawals.accountBankNumber);
          	$("#money").text(withdrawals.money);
          	$("#type").text(withdrawals.type);
          	$("#status").text(withdrawals.status);
          	$("#withdrawals").text(withdrawals.withdrawals);
          }
      	})
   	});
   	
   	function deal(type) {
   		var withdrawalsUuid = "${withdrawalsUuid}";
  		var baseURL = "${webPath}/withdrawals/deal";
  		if(type == 0){
  			alert("暂不支持驳回操作");
  			return;
  		}
      	var json_package = {
           "head": {},
           "body": {
           	"withdrawalsUuid": withdrawalsUuid,
           	"type": type
           }
       	}
   		$.post(baseURL, {"json_package": JSON.stringify(json_package)}, function (result) {
          if (typeof result == 'string') result = JSON.parse(result);
          if (result.body.result == '1') {
              alert(result.body.description)
          } else {
        	  alert(result.body.description)
        	  $("#status").text("已提现");
          }
      	})
	}
</script>
</body>
</html>
